import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Flow from "../views/Layout/index.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    hidden: true,
    component: Home,
    redirect: "/flow"
  },
  {
    path: "/about",
    hidden: true,
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue")
  },
  {
    path: "/flow",
    name: "Flow",
    hidden: false,
    component: Flow,
    meta: { "title": "流程管理" },
    children: [
      {
        path: "/flow/from",
        hidden: false,
        name: "From",
        component: () => import('../views/FlowManage/FromManage.vue'),
        meta: { "title": "表单管理" }
      },
      {
        path: "/flow/processEdit",
        hidden: false,
        name: "ProcessEdit",
        component: () => import('../views/FlowManage/ProcessEdit.vue'),
        meta: { "title": "流程定义" }
      },
      {
        path: "/flow/processInstance",
        hidden: false,
        name: "ProcessInstance",
        component: () => import('../views/FlowManage/ProcessInstance.vue'),
        meta: { "title": "流程实例" }
      },
      {
        path: "/flow/task",
        hidden: false,
        name: "Task",
        component: () => import('../views/bpmn/components/custom-properties-panel.vue'),
        meta: { "title": "BPMN" }
      }
    ]
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
